package com.ytjj.qmyx.admin.controller;

import com.ytjj.common.api.CommonResult;
import com.ytjj.qmyx.admin.annotation.OperLog;
import com.ytjj.qmyx.admin.constants.SysLogConstants;
import com.ytjj.qmyx.admin.service.HotProductBannerService;
import com.ytjj.qmyx.mall.model.HotProductBanner;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 *
 *
 * @Version: 1.0
 *
 * 爆品管理-Banner
 */
@RestController
@RequestMapping("/hotProductBanner")
public class HotProductBannerController {

    @Resource
    private HotProductBannerService hotProductBannerService;

    @GetMapping("/bannerList")
    @OperLog(operModule = "爆品管理-Bannner", operDesc = "Bannner列表", operType = SysLogConstants.OPERATION_SELECT)
    public CommonResult selectList(@RequestParam Integer hotProductId, @RequestParam int pageNum, @RequestParam int pageSize) {
        return CommonResult.success(hotProductBannerService.selectList(hotProductId, pageNum, pageSize));
    }

    @GetMapping("/insert")
    @OperLog(operModule = "爆品管理-Bannner", operDesc = "增加Banner", operType = SysLogConstants.OPERATION_ADD)
    public CommonResult insertBanner(HotProductBanner hotProductBanner) {
        return CommonResult.success(hotProductBannerService.insertBanner(hotProductBanner));
    }

    @GetMapping("/update")
    @OperLog(operModule = "爆品管理-Bannner", operDesc = "修改", operType = SysLogConstants.OPERATION_UPDATE)
    public CommonResult updateBanner(HotProductBanner hotProductBanner) {
        return CommonResult.success(hotProductBannerService.updateBanner(hotProductBanner));
    }

    @GetMapping("/remove")
    @OperLog(operModule = "爆品管理-Bannner", operDesc = "移除", operType = SysLogConstants.OPERATION_DELETE)
    public  CommonResult removeBanner(@RequestParam Integer id) {
        return CommonResult.success(hotProductBannerService.removeBanner(id));
    }
}
